# Contributor: Fabian Affolter <fabian@affolter-engineering.ch>
# Maintainer: Fabian Affolter <fabian@affolter-engineering.ch>
pkgname=py3-paramiko
pkgver=3.4.0
pkgrel=0
pkgdesc="SSH2 protocol library for Python3"
url="https://www.paramiko.org/"
arch="noarch"
license="LGPL-2.0-or-later"
depends="
	py3-bcrypt
	py3-cryptography
	py3-pynacl
	"
makedepends="
	py3-gpep517
	py3-setuptools
	py3-wheel
	"
checkdepends="py3-pytest-xdist"
subpackages="$pkgname-doc $pkgname-pyc"
source="$pkgname-$pkgver.tar.gz::https://github.com/paramiko/paramiko/archive/refs/tags/$pkgver.tar.gz"
builddir="$srcdir/paramiko-$pkgver"
options="!check" # missing icecream

replaces="py-paramiko" # Backwards compatibility
provides="py-paramiko=$pkgver-r$pkgrel" # Backwards compatibility

# secfixes:
#   3.4.0-r0:
#     - CVE-2023-48795
#   2.4.2-r0:
#     - CVE-2018-1000805
#   2.4.1-r0:
#     - CVE-2018-7750

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	.testenv/bin/python3 -m pytest -n auto -W ignore::DeprecationWarning
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl

	mkdir -p "$pkgdir"/usr/share/doc/$pkgname/demos
	cp -a demos "$pkgdir"/usr/share/doc/$pkgname/
}

doc() {
	default_doc
	provides="$pkgname-demos=$pkgver-r$pkgrel"
	replaces="$pkgname-demos"
}

sha512sums="
f78fccf653d05acee78dfb76fb662c85fbfea7901fd94460a2d2e526c9b25169993051d20c16cfe0b7745008b1ea3a745fc9a280386d98a06689aaadf78f6752  py3-paramiko-3.4.0.tar.gz
"
